package com.demo.rw;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicDemo {
    public static void main(String[] args) {
        AtomicInteger num = new AtomicInteger(2020);
        int andIncrement = num.getAndIncrement();

        num.compareAndSet(2020, 2021);
        System.out.println(num.get());
        num.compareAndSet(2020, 2021);
        System.out.println(num.get());

    }
}
